package com.example.project1;

import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;

import java.util.ArrayList;
import java.util.List;


public class weixin_shezhi extends Fragment {

    private Context context;
    //图片列表
    private List<Integer> mList = new ArrayList<Integer>();

    public weixin_shezhi() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_shezhi, container, false);

        context = view.getContext();

        //添加数据
        InitImageList();

        //创建Adapter对象
        RecyclerView recyclerView = view.findViewById(R.id.recyclerview_circle_friend);

        StaggeredGridAdapter adapter = new StaggeredGridAdapter(context, mList);
        recyclerView.setAdapter(adapter);

        recyclerView.setLayoutManager(new StaggeredGridLayoutManager(3, StaggeredGridLayoutManager.VERTICAL));
        return view;
    }
    private void InitImageList(){
        mList.add(R.drawable.hanhong);
        mList.add(R.drawable.hanlei);
        mList.add(R.drawable.cuijian);

    }
}